package sair.player.ui;

import java.awt.Component;
import java.awt.Font;

import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.ListCellRenderer;

class LRCListCellRenderer extends JLabel implements ListCellRenderer<String> {

	/**
	 *
	 */
	private static final long serialVersionUID = -5523679986019468529L;

	@Override
	public Component getListCellRendererComponent(JList<? extends String> list, String value, int index,
			boolean isSelected, boolean cellHasFocus) {
		this.setText(value);
		if (isSelected) {
			Font oldFont = list.getFont();
			float size = (float) oldFont.getSize() + 10;
			Font sFont = oldFont.deriveFont(size);
			this.setForeground(list.getSelectionForeground());
			this.setFont(sFont);
		} else {
			this.setForeground(list.getForeground());
			this.setFont(list.getFont());
		}
		return this;
	}

}
